// @ts-ignore
/* eslint-disable */
import { request } from '@umijs/max';
import qs from 'qs';
const baseURL = AUTH_URL;
// API_URL
/** 获取当前的用户 GET  */
export async function currentUser(options?: { [key: string]: any }) {
  return request<{
    data: API.CurrentUser;
  }>(baseURL + '/user/info', {
    method: 'GET',
    ...(options || {}),
  });
}
/** 获取当前的用户 GET  */
export async function getFilterUser(options?: { [key: string]: any }) {
  return request<API.userResult>(baseURL + '/user/show/filter', {
    method: 'GET',
    ...(options || {}),
  });
}

/** 租户 get */
export async function login(params: API.LoginParams, options?: { [key: string]: any }) {
  return request<API.LoginResult>(baseURL + '/tenant/list/name', {
    method: 'get',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}
/** 登录接口 POST  */
export async function getToken(data: API.TokenParams, options?: { [key: string]: any }) {
  return request<API.LoginResult>(baseURL + '/oauth/token', {
    method: 'post',
    data: qs.stringify(data),
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8',
    },
    auth: {
      username: 'iot_web',
      password: 'iot_web',
    },
    ...(options || {}),
  });
}
